nsfont.m (ns_findfonts): Handle empty matchingDescs (Bug#11541).
authorJan D. <jan.h.d@swipnet.se>
Thu, 8 Nov 2012 19:51:07 +0000 (20:51 +0100)
committerJan D. <jan.h.d@swipnet.se>
Thu, 8 Nov 2012 19:51:07 +0000 (20:51 +0100)
src/ChangeLog
src/nsfont.m

index 46e86d014d37cafcb3898f9b705431aabb073dfe..62f245705a2a269512c137757fa5a76a05b3a854 100644 (file)
@@ -1,3 +1,7 @@
+2012-11-08  Thomas Kappler <tkappler@gmail.com> (tiny change)
+
+       * nsfont.m (ns_findfonts): Handle empty matchingDescs (Bug#11541).
+
 2012-11-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        Use ad-hoc comparison function for the profiler's hash-tables.
index 4f29d1d54a9ca2110426b8e55c15c168d0ecf4dc..d2e5108bb7f709aa788f6303b91f1ab96aa07091 100644 (file)
@@ -559,7 +559,11 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
     if (isMatch)
        [fkeys removeObject: NSFontFamilyAttribute];
 
-    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
+    if ([fkeys count] > 0)
+      matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
+    else
+      matchingDescs = [NSMutableArray array];
+
     if (NSFONT_TRACE)
        NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
              [matchingDescs count]);